﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ContentPlaceHolderID="StyleContent" runat="server"></asp:Content>
<asp:Content ContentPlaceHolderID="PageTitle" runat="server">部门通讯录</asp:Content>
<asp:Content ContentPlaceHolderID="ViewTitle" runat="server">
    部门通讯
</asp:Content>
<asp:Content ContentPlaceHolderID="ViewContent" runat="server">
    <ul class="list-group" id="contact_list" style="color: black">
        <%var list = ViewData["ContactList"] as List<NoteManger.TEmployeeItem>;%>
        <%foreach (var item in list)
          { %>
        <li class="list-group-item">
            <div class="row">
                <div class="col-xs-9 text-left">
                    <h4 class="list-group-item-heading"><%:item.UserName %></h4>
                </div>
                <div class="col-xs-3 text-right">
                    <a href="javascript:void(0)" onclick="toClipboard(this);">[复制]</a>
                </div>
            </div>
            <p class="list-group-item-text">小组:<%:item.GroupName %></p>
            <p class="list-group-item-text">联系电话: <a href='tel:<%:item.Tel %>'><%:item.Tel %></a></p>
            <p class="list-group-item-text">QQ: <%:item.QQ %></p>
            <input type="hidden" value="<%: item.ShortCode %>" />
        </li>

        <%} %>
    </ul>
</asp:Content>
<asp:Content ContentPlaceHolderID="ViewFooter" runat="server">
    <div class="input-group">
        <input type="text" class="form-control" onkeyup="doSearch($.trim(this.value.toLowerCase()));">
        <span class="input-group-addon"><i class="cus-icon-search"></i></span>
    </div>
</asp:Content>
<asp:Content ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        function doSearch(val) {
            var list = $("#contact_list>li");
            list.each(function () {
                var name = $.trim($(this).children("h4").text().toLowerCase());
                var code = $.trim($(this).children("input").val());
                var visible = !val || name.indexOf(val) >= 0 || code.indexOf(val) >= 0;
                if (visible) $(this).show();
                else $(this).hide();
            });
        }
        function toClipboard(sender) {
            var content = [];
            $(sender).parents("li").find("h4,p").each(function () {
                content.push($(this).text());
            });
            copyToClipboard(content.join("\r\n"));
            $(sender).hide();

        }
    </script>
</asp:Content>
